package model;

import java.util.ArrayList;

public class Distr {
	
	private Long id;
	private String name;
	//private ArrayList<Store> stores;
	private String town;
	
	public Distr() {
		
	}
	
	public Distr(Long id, String name, String town) {
		this.id = id;
		this.name = name;
		this.town = town;
	}
	
	public Distr(Long id, String name, ArrayList<Store> stores) {
		this.id = id;
		this.name = name;
		//this.stores = stores;
	}

	public Long getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getFullname() {
		return (this.id + " " + this.name + "(" + this.town + ")");
	}

	@Override
	// This must return true for another User object with same key/id.
    public boolean equals(Object other) {
        return other instanceof Distr && (id != null) ? id.equals(((Distr) other).id) : (other == this);
    }

    // This must return the same hashcode for every User object with the same key.
    @Override
    public int hashCode() {
        return id != null ? this.getClass().hashCode() + id.hashCode() : super.hashCode();
    }

    // Override Object#toString() so that it returns a human readable String representation.
    // It is not required by the Converter or so, it just pleases the reading in the logs.
    @Override
    public String toString() {
        return getFullname();
    }

}
